<?php
  
  class content_tree {
      
      
      public $deleteUrl = "";
      
      
      
      function getAdminMenu() {
          
          
          
          
          $itemParentId=db::getValue("SELECT id FROM content WHERE _url='/main'");

          $this->getContentList($itemParentId);
              
          
      }
      
      
      
      private function getContentList($itemParentId)
    {
    if (db::getCount("content", "item_parent_id='{$itemParentId}'") > 0)
        {
        echo "<ul>";

        foreach (db::getData("content", "item_parent_id='{$itemParentId}'", "item_order") as $data)
            {
            echo '<li><a href="'.config::$baseUrl.$data['_url'].'">' . $data['title'] . '</a> - 
            
            <a href="'.config::$baseUrl.'/page-property?id='.config::$baseUrl.$data['content_id'].'">editieren</a> 
            - <a href="'.$this->deleteUrl.'?id='. $data['id'] .'">löschen</a></li>';

            $this->getContentList($data['id']);
            }

        echo "</ul>";
        }
    }
          
      
      
      
      
  }
  
?>
